<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('班级详情')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form class="form-horizontal m" id="form-classes-info" th:object="${teachingClasses}">
                <input name="classId" th:field="*{classId}" type="hidden">
                <input name="courseId" th:field="*{courseId}" type="hidden">
                <div class="form-group">
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">班级名：</label>
                        <div class="col-sm-6">
                            <div class="form-control">[[*{className}]]</div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">所属课程：</label>
                        <div class="col-sm-6">
                            <div class="form-control">[[*{courseName}]]</div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">班级人数：</label>
                        <div class="col-sm-6">
                            <div class="form-control"
                                 th:text="|${teachingClasses.classStudent}/${teachingClasses.maxStudent} ${@dict.getLabel('sys_classes_status', teachingClasses.status)}|"></div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">上课校区：</label>
                        <div class="col-sm-6">
                            <div class="form-control">[[*{schoolName}]]</div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">上课老师：</label>
                        <div class="col-sm-6">
                            <div class="form-control">[[*{teacherName}]]</div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">上课教室：</label>
                        <div class="col-sm-6">
                            <div class="form-control">[[*{classroomName}]]</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">开班日期：</label>
                        <div class="col-sm-6">
                            <div class="form-control">[[${#dates.format(teachingClasses.startDate,
                                'yyyy-MM-dd')}]]
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">结班日期：</label>
                        <div class="col-sm-6">
                            <div class="form-control">[[${#dates.format(teachingClasses.endDate,
                                'yyyy-MM-dd')}]]
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">上课日期：</label>
                        <div class="col-sm-6">
                            <div class="form-control">[[${#dates.format(teachingClasses.teachTime,
                                'yyyy-MM-dd')}]]
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4">
                        <label class="col-sm-4 control-label">备注：</label>
                        <div class="col-sm-8">
                            <div class="form-control">[[*{remark}]]</div>
                        </div>
                    </div>
                </div>
            </form>
            <div class="tabs-container" style="padding-top: 20px;">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">学员信息</a>
                    </li>
                    <!--          <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">文件夹</a>-->
                    <!--          </li>-->
                </ul>
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-success" onclick="selectCheckStudents()">
                        <i class="fa fa-plus"></i> 添加学员
                    </a>
                </div>
                <div class="tab-content">
                    <div id="tab-1" class="tab-pane active">
                        <div class="panel-body">
                            <table id="bootstrap-table"></table>
                        </div>
                    </div>
                    <!--          <div id="tab-2" class="tab-pane">-->
                    <!--            <div class="panel-body">-->
                    <!--              <table id="school-files"></table>-->
                    <!--            </div>-->
                    <!--          </div>-->
                </div>


            </div>
        </div>


    </div>

</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var classId = [[${teachingClasses.classId}]];
    var data1 = [[${@dict.getType('sys_user_sex')}]];
    var data2 = [[${@dict.getType('sys_family_ref')}]];

    function selectCheckStudents() {
        var url = ctx + "teaching/classes";
        console.log(url);
        $.modal.open("添加学员", url + "/addStudent/" + classId);
    }

    $(function () {
        var options = {
            url: ctx + "teaching/students/list",
            queryParams: {classId: classId},
            modalName: "教务学员",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            columns: [{
                checkbox: true
            },
                {   field: 'studentId',
                    title: '学生主键ID',
                    visible: false
                },
                {
                    field: 'teachingStudent.studentName',
                    title: '学生姓名',
                },
                {
                    field: 'teachingStudent.sex',
                    title: '性别',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(data1, value);
                    }
                },
                {
                    field: 'teachingStudent.familyRefMain',
                    title: '关系',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(data2, value);
                    }
                },
                {
                    field: 'teachingStudent.phonenumber',
                    title: '手机号码',
                },
                {
                    field: 'lessonConsume',
                    title: '已用课时',
                },
                {
                    field: 'teachingStudentApply.lessonRemain',
                    title: '剩余课时',
                }
                ]
        };
        $.table.init(options);
    });
</script>
</body>
</html>